import QtQuick
import QtQuick.Window

Window {
    width: 500 /*background.width*/ // 绑定, 不是赋值
    height: 300 /*background.height*/
    visible: true
    title: qsTr("转呀转呀")

    Image { // topmost的先绘制
        anchors.fill: parent; // 用当前元素填充parent
        id: background // 就像C++引用, 不能动态修改
        source: "images/background.png" // url

        Image {
            anchors.bottom: parent.bottom
            anchors.horizontalCenter: parent.horizontalCenter
            id: pole
            source: "images/pole.png"

            Image {
                anchors.verticalCenter: parent.top
                anchors.horizontalCenter: parent.horizontalCenter
                id: wheel
                source: "images/pinwheel.png"

                Behavior on rotation { // 为特定的属性修改行为提供动画
                    NumberAnimation {
                        // 动画时间
                        duration: 500 // ms
                    }
                }
            }
        }

        MouseArea {
            anchors.fill: parent
            onClicked: wheel.rotation += 90
        }
    }

}
